<?php
namespace GRH\Model\Table;

use Zend\Db\TableGateway\AbstractTableGateway;
use Zend\Db\Adapter\Adapter;
use Zend\Db\ResultSet\ResultSet;

use Zend\Db\Sql\Sql;
use Zend\Db\Sql\Where;
use Zend\Db\Sql\Expression;
use Zend\Db\Sql\Select;

use GRH\Model\Couleur;

class CouleurTable extends AbstractTableGateway
{
    protected $table = 'grh_couleur';
    
    public function __construct(Adapter $adapter)
    {
        $this->adapter = $adapter;
        $this->resultSetPrototype = new ResultSet();
        $this->resultSetPrototype->setArrayObjectPrototype(new Couleur());
        $this->initialize();
    }
    
    public function getAll()
    {
        return $this->select();
    }
    
    public function getSelectList()
    {
        $rows = $this->select();
        $arr = array();
        foreach($rows as $couleur)
            $arr[$couleur->code] = $couleur->libelle;
        
        return $arr;
    }
}